using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest2.Entitys
{
    /// <summary>
    /// 系统权限
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='系统权限']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class SysRight
    {
        /// <summary>
        /// right_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary(Automatic = true)]
        public int RightId { get; set; }

        /// <summary>
        /// right_name
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column(64)]
        public string RightName { get; set; }

        /// <summary>
        /// 权限代号
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) NOT NULL COMMENT '权限代号']]>
        /// </remarks>
        [Column(64, false)]
        [DisplayName("权限代号")]
        public string RightCode { get; set; }

        [JsonConverter(typeof(AutoEnumConverter))]
        public RightKeysEnum RightKeysName => (RightKeysEnum)RightKeys;

        /// <summary>
        /// 权限键 [Owner=1,Add=2,Edit=4,Delete=8,Import=16,Export=32,Special=64]
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '权限键 [Owner=1,Add=2,Edit=4,Delete=8,Import=16,Export=32,Special=64]']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("权限键")]
        public int RightKeys { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '描述']]>
        /// </remarks>
        [Column(255)]
        [DisplayName("描述")]
        public string Description { get; set; }

        /// <summary>
        /// sort
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(false)]
        public int Sort { get; set; }

        /// <summary>
        /// is_del
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(1, false)]
        public bool IsDel { get; set; }

    }
}
